﻿package plugin.roleN.compoment
{
    import com.core.*;
    import com.sh.game.util.*;
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import morn.core.components.*;
    import uiresource.roleui.*;
    import vo.*;

    public class XiangQianItem extends Sprite
    {
        private var mType:int;
        private var ishover:Boolean;
        private var IsDown:Boolean;
        public var isXq:Boolean;
        private var txtsp:Sprite;
        private var _txt1:Label;
        private var _txt2:Label;
        private var _data:Object;
        public var index:int;
        private var _item:BaoShiItemUI;

        public function XiangQianItem()
        {
            this.txtsp = new Sprite();
            this._item = new BaoShiItemUI();
            this._item.x = 5;
            this._item.y = 11;
            this._item.visible = false;
            this.addChild(this._item);
            this.txtsp.x = -10;
            this.txtsp.y = 70;
            this._txt1 = new Label();
            this._txt1.width = 150;
            this._txt1.color = MColor.New7;
            this._txt1.stroke = "0x0";
            this._txt1.align = "left";
            this._txt1.x = 12;
            this._txt1.mouseChildren = false;
            this._txt1.mouseEnabled = false;
            this._txt2 = new Label();
            this._txt2.width = 150;
            this._txt2.text = "特殊";
            this._txt2.color = MColor.New7;
            this._txt2.stroke = "0x0";
            this._txt2.align = "left";
            this._txt2.x = 12;
            this._txt2.y = 25;
            this._txt2.visible = false;
            this.txtsp.visible = false;
            this.initEvent();
            return;
        }// end function

        private function initEvent() : void
        {
            this._txt2.addEventListener(MouseEvent.MOUSE_OVER, this.showtips);
            return;
        }// end function

        private function mouseOver(event:MouseEvent) : void
        {
            var _loc_2:Point = null;
            var _loc_3:Object = null;
            if (this.data)
            {
                _loc_2 = new Point(mouseX, mouseY);
                _loc_3 = ItemObject.create(this.data);
                if (this.data.itemtype == 1)
                {
                    ModelProxy.change("tips", "arm", {data:_loc_3, p:_loc_2});
                }
                else
                {
                    ModelProxy.change("tips", "tool", {data:_loc_3, p:_loc_2});
                }
            }
            return;
        }// end function

        private function mouseOut() : void
        {
            if (this.data)
            {
                ModelProxy.change("tips", "state", "close");
            }
            return;
        }// end function

        public function showtips(event:MouseEvent) : void
        {
            ModelProxy.change("tips", "normal", {data:"本位置只能镶嵌特殊宝石", p:new Point(mouseX, mouseY)});
            return;
        }// end function

        private function closeTips(event:MouseEvent) : void
        {
            ModelProxy.change("tips", "state", "close");
            return;
        }// end function

        public function get data() : Object
        {
            return this._data;
        }// end function

        public function set data(param1:Object) : void
        {
            if (param1 == null)
            {
                this._txt2.visible = true;
            }
            this._data = param1;
            this.txtsp.visible = param1;
            this._item.visible = false;
            if (this.data)
            {
                this._txt2.visible = false;
                this._item.nbitem.data = this._data;
                this._item.visible = true;
            }
            return;
        }// end function

    }
}
